package br.com.rafaelSys.entidades;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;

@Entity
@Name("ativo")
@Table(name = "ATIVO")
@NamedQueries({ @NamedQuery(name = "Ativo.checkCarteiras", query = "select ac.carteira from AtivoCarteira ac where ac.ativo = :ativo") })
public class Ativo implements Serializable {

	private static final long serialVersionUID = -8444845401043121382L;

	private Integer id;

	private String nome;
	private String simbolo;

	private Date ultimaAtualizacao;
	private Date dataCargaInicial;

	private Usuario usuario;

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "nome")
	@Length(max = 100)
	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@Length(max = 50)
	@NotNull
	@Column(name = "simbolo")
	public String getSimbolo() {
		return simbolo;
	}

	public void setSimbolo(String simbolo) {
		this.simbolo = simbolo;
	}

	@Column(name = "data_atualizacao")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getUltimaAtualizacao() {
		return ultimaAtualizacao;
	}

	public void setUltimaAtualizacao(Date ultimaAtualizacao) {
		this.ultimaAtualizacao = ultimaAtualizacao;
	}

	@Column(name = "data_inicial")
	@Temporal(TemporalType.DATE)
	public Date getDataCargaInicial() {
		return dataCargaInicial;
	}

	public void setDataCargaInicial(Date dataCargaInicial) {
		this.dataCargaInicial = dataCargaInicial;
	}

	@ManyToOne
	@NotNull
	public Usuario getUsuario() {
		return usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}

}
